<template>
  <div class="app-container">
    <el-form ref="form" :model="detail" label-width="80px">
      <el-form-item label="id">
        <div>{{detail.id}}</div>
      </el-form-item>
      <el-form-item label="仓库名字">
        <div>{{detail.storageName}}</div>
      </el-form-item>
      <!--<el-form-item label="冷库别称">
        <div>{{detail.shortName}}</div>
      </el-form-item>
      <el-form-item label="联系人">
        <div>{{detail.contactName}}</div>
      </el-form-item>
      <el-form-item label="联系电话">
        <div>{{detail.contactPhone}}</div>
      </el-form-item>-->
      <el-form-item label="仓库说明">
        <div>{{detail.storageDesc}}</div>
      </el-form-item>
      <el-form-item label="仓库状态">
        <div>{{detail.status|statusName()}}</div>
      </el-form-item>
      <el-form-item label="创建时间">
        <div>{{detail.createTime}}</div>
      </el-form-item>
      <el-form-item label="更新时间">
        <div>{{detail.updateTime}}</div>
      </el-form-item>

    </el-form>
  </div>


</template>

<script>
import {fetchStorage} from "../../api/storage";

export default {
  name: "detail",
  data(){
    return {
      detail:{
        createTime: '',
        updateTime: '',
        status: '',
        id: '',
        storageName: '',
        shortName: '',
        contactName: '',
        contactPhone: ''
      }
    }
  },
  filters: {
    statusName(status) {
      if (status===1) {
        return '正常';
      }else{
        return '异常'
      }
    }
  },
  created() {
    this.getDetail(this.$route.query.id)
  },
  methods:{
    getDetail(id){
      fetchStorage({id:id}).then(response => {
        this.detail = response.data.data
    })
  }
  }
}
</script>

<style scoped>

</style>
